<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <form class="form-inline" action="{:U('index')}" method="get" style="float:left">

                                <label class="inline">书籍名称搜索</label>
                                <input type="text" name="keyword" value="{:I(keyword)}" class="form-control">
                                <label class="inline">&nbsp;&nbsp;排序：</label>
                                <select name="order" class="form-control">
                                    <option <if condition="I('order') eq asc">selected</if> value="asc">转化率升</option>
                                    <option <if condition="I('order') eq desc">selected</if> value="desc">转化率降</option>
                                </select>
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </button>
                                &nbsp;&nbsp;
                                <a class="btn btn-info" href="{:U('index',['type'=>'new'])}" value="" style="padding: 2px 12px;">新书上架</a>
                                <a class="btn btn-info" href="{:U('index',['type'=>'up'])}" value="" style="padding: 2px 12px;">最近更新</a>
                            </form>

                        </div>
                        <div class="space-4"></div>
                        <div class="row">
                            <div class="col-xs-12">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <th>封面</th>
                                    <th>小说名称</th>
                                    <th>状态</th>
                                    <th>派单提数</th>
                                    <!--<th>推广链接</th>
                                    <th>推广海报</th>-->
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    <volist name='data.list' id="vo">
                                        <tr>
                                            <td class="text-center"><img src="{$vo.book_img}" width="60"/></td>
                                            <td class="promote_list_td">
                                                <a href="{:U('view' , ['bookid' =>$vo['bookid']])}">【{$vo.typename}】{$vo.book_title}</a>
                                                [<if condition="$vo['book_status'] eq 0">连载<else/>完结</if>] 
                                            </td>
                                            <td><span class="btn btn-success btn-xs">已上架</span></td>
                                            <td>
                                                <if condition="session('uid') eq 1">
                                                    <input type="text" name="bookindex"  class="input-mini" value="{$vo.book_index|default=0}" data-bookid="{$vo.bookid}"/>
                                                <else/>
                                                    {$vo.book_index}
                                                </if>
                                            </td>
                                            <!--<td class="promote_list_td"><input type="text" class="promote_list_input" value="【{$vo.typename}】{$vo.book_title}{$vo.shorturl}" readonly="readonly"/><button class="btn btn-copy promote_list_copy">复制</button></td>
                                            <td><img src=""/></td>-->

                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </div>
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>
</div><!-- /.main-container -->
<include file="Public/footerjs"/>
<script type="text/javascript">
    $(function () {
        $(".btn-copy").on("click", function () {
            var a = $(this).prev("input[type=text]").select();
            document.execCommand("Copy");
            layer.alert("链接已经复制到粘贴板");
            return false;

        });
        
        <if condition ="session('uid') eq 1">
        $("input[name=bookindex]").blur(function(){
            var bookid = $(this).attr("data-bookid");
            var index = $(this).val();
            if(index >= 0){
                $.post("{:U('setbookindex')}" , {bookid:bookid,index:index} , function(data){
                    
                })
            }
        });
        </if>
    });
</script>
</body>
</html>